$OpenBSD: patch-cpp_SConscript,v 1.2 2012/04/27 19:55:53 naddy Exp $
--- cpp/SConscript.orig	Sat Jan 14 11:38:44 2012
+++ cpp/SConscript	Fri Apr 27 21:38:41 2012
@@ -5,9 +5,9 @@ import fnmatch
 import os
 
 vars = Variables()
-vars.Add(BoolVariable('DEBUG', 'Set to disable optimizations', 1))
+vars.Add(BoolVariable('DEBUG', 'Set to disable optimizations', 0))
 vars.Add(BoolVariable('PIC', 'Set to 1 for to always generate PIC code', 0))
-env = Environment(variables = vars)
+env = Environment(variables = vars, CXX = "${CXX}")
 # env.Replace(CXX = "clang++") 
 
 debug = env['DEBUG']
@@ -17,7 +17,7 @@ if debug:
 	#compile_options['CPPDEFINES'] = "-DDEBUG"
 	flags.append("-O0 -g3 -ggdb -Wall")
 else:
-	flags.append("-Os -g3 -Wall")
+	flags.append("${CXXFLAGS} -Wall")
 if env['PIC']:
 	flags.append("-fPIC")
 
@@ -26,7 +26,7 @@ flags.append("-Wextra -Werror")
 # flags.append("-pedantic")
 
 compile_options['CXXFLAGS'] = ' '.join(flags)
-compile_options['LINKFLAGS'] = "-ldl -L/usr/lib -L/opt/local/lib"
+compile_options['LINKFLAGS'] = '-L/usr/lib -L/opt/local/lib -L${LOCALBASE}/lib -L${X11BASE}/lib -pthread'
 
 def all_files(dir, ext='.cpp', level=6):
 	files = []
@@ -36,8 +36,8 @@ def all_files(dir, ext='.cpp', level=6):
 
 
 
-magick_include = ['/usr/include/ImageMagick/', '/opt/local/include/ImageMagick/']
-magick_libs = ['Magick++', 'MagickWand', 'MagickCore']
+magick_include = ['${LOCALBASE}/include', '${LOCALBASE}/include/ImageMagick/']
+magick_libs = ['Magick++', 'MagickWand', 'MagickCore', 'iconv']
 
 # check for existence of libiconv and add it to magick_libs if possible
 matches = []
@@ -53,7 +53,7 @@ cppunit_libs = ['cppunit']
 
 zxing_files = all_files('core/src')
 
-zxing_include = ['core/src']
+zxing_include = ['${LOCALBASE}/include', 'core/src']
 zxing_libs = env.Library('zxing', source=zxing_files, CPPPATH=zxing_include, **compile_options)
 
 app_files = ['magick/src/MagickBitmapSource.cpp', 'magick/src/main.cpp']
